<template>
	<view class='content'>
		<view style="height: 10px;">
			
		</view>
		<u-cell-group class='list'>
			<u-cell title="头像">
				<view
					slot="value"
					class="u-slot-value"
				>
					<u-avatar :src="userInfo.head_img" size='50'></u-avatar>
				</view>
			</u-cell>
			<u-cell title="昵称" :value='userInfo.nickname'>
			</u-cell>
			<u-cell title="我的二维码" isLink>
				<view
					slot="value"
					class="u-slot-value"
				>
					<u-image  class='right' width="80px" height="80px" :src="userInfo.img" @click='Image'></u-image>
				</view>
			</u-cell>
			<u-cell title="性别">
				<view
					slot="value"
					class="u-slot-value"
				>
					{{userInfo.sex == 1 ? '男' : userInfo.sex == 2 ? "女" :"无"}}
				</view>
			</u-cell>
			<u-cell title="修改手机号" isLink @click="changeMobile()">
				<view
					slot="value"
					class="u-slot-value"
				>
					{{ userInfo.mobile }}
				</view>
			</u-cell>
		</u-cell-group>
		
		<u-popup :show="show" mode='center'closeable @close="close" @open="open">
			<view class='propImg'>
				<u-image  class='right' width="240px" height="240px" :src="userInfo.img"></u-image>
				<view class="right">
					我的二维码
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},
				show: false
			}
		},
		onLoad() {
			this.getuserInfo()
		},
		methods: {
			Image(){
				this.show = true
			},
			open(){},
			close(){
				this.show = false
			},
			changeMobile(){
				uni.navigateTo({
					url: '/pages/changeMobile/changeMobile?mobile='+this.userInfo.mobile
				})
			},
			getuserInfo(){
				var _this = this
				this.fq_post('wxsite/User/userImgv2', {
					
				}, (res) => {
					console.log(res)
					if(res.code == 1){
						_this.userInfo = res.data
					}
				})
				// uni.request({
				// 	url: 'http://www.yndzfl.cn/wxsite/User/userImgv2',
				// 	method: 'POST',
				// 	header:{
				// 		"Content-Type" : "application/x-www-form-urlencoded"
				// 	},
				// 	data: {
				// 		openid: uni.getStorageSync('OPENID')
				// 	},
				// 	success(res) {
				// 		console.log(res)
				// 		if(res.data.code == 1){
				// 			_this.userInfo = res.data.data
				// 		}
						
				// 	}
				// })
			}
		}
	}
</script>

<style scoped>
.list{
	background-color: #fff;
}
.right{
	text-align: center;
}
.propImg{
	padding: 20px;
}
</style>
